package scms;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;;

@Controller
public class ViewController {
	
	@RequestMapping(value="/getView/**",method=RequestMethod.GET)
	public ModelAndView getView(HttpServletRequest request,ModelAndView modelAndView){
		String uri = request.getRequestURI();
		String contextPath = request.getContextPath();
		String view = uri.substring((contextPath+"/getView").length(),uri.length());
		modelAndView.addObject("contextPath", contextPath);
		modelAndView.setViewName(view);
		return modelAndView;
	}
	
}
